
#ifndef WIN32

#define YIELD yield
#define TASK_PTR task_ptr
#define SCHEDULE schedule
	
#else 

#define YIELD _yield
#define TASK_PTR _task_ptr
#define SCHEDULE _schedule

#endif


	.text
	// yield - save state of current task, switch to new one
	.align	8

	.global YIELD
YIELD:
	pushl	%edi
	pushl	%esi
	pushl	%ebx
	pushl	%ebp

	movl	TASK_PTR, %eax
	movl	%esp, (%eax)
	call	SCHEDULE
	movl	TASK_PTR, %eax
	movl	(%eax), %esp

	popl	%ebp
	popl	%ebx
	popl	%esi
	popl	%edi
	ret

